package com.google.ant.extensions.tasks;

import org.apache.tools.ant.Task;

public class PropertyTransformerTask extends Task {
    protected String property;
    protected String expression;
    protected String source;
    protected String replacement;

    public void setReplacement(String r) {
        this.replacement = r;
    }

    public String getReplacement() {
        return this.replacement;
    }

    public void setProperty(String p) {
        this.property = p;
    }

    public String getProperty() {
        return this.property;
    }

    public void setSource(String s) {
        this.source = s;
    }

    public String getSource() {
        return this.source;
    }

    public void setExpression(String exp) {
        this.expression = exp;
    }
    
    public String getExpression() {
        return this.expression;
    }

    public void execute() {
        String result = getSource().replaceAll(getExpression(), getReplacement());
        getProject().setNewProperty(getProperty(), result);
    }
}
